package com.wxl.ruiji.controller;

import com.wxl.ruiji.common.R;
import com.wxl.ruiji.entity.Orders;
import com.wxl.ruiji.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(tags = "订单管理")
@RequestMapping("/addressBook")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 用户下单
     *
     * @param orders
     * @return
     */
    @ApiOperation(value = "用户下单")
    @PostMapping("/submit")
    public R<String> submit(@RequestBody Orders orders) {

        log.info("订单数据：{}", orders);

        orderService.submit(orders);

        return R.success("下单成功");

    }

}
